import { QuickActionMode } from '../../common';
import { DataItemProvider } from '../../interface';

/**
 * 列表数据项
 *
 * @author chitanda
 * @date 2022-06-28 18:06:15
 * @export
 * @class DefaultModeDataItemProvider
 * @implements {DataItemProvider}
 */
export class DefaultModeDataItemProvider implements DataItemProvider {
  readonly id: string = '';
  readonly label: string;
  readonly tooltip?: string;
  readonly icon?: string;
  readonly description?: string;
  readonly $mode: QuickActionMode;

  /**
   * Creates an instance of DefaultModeDataItemProvider.
   *
   * @author chitanda
   * @date 2022-06-30 11:06:54
   * @param {string} id
   * @param {QuickActionMode} mode
   */
  constructor(id: string, mode: QuickActionMode) {
    const { opts } = mode;
    this.id = id;
    this.label = opts.title;
    this.icon = opts.icon;
    this.description = opts.description;
    Object.defineProperty(this, '$mode', {
      value: mode,
    });
  }
}
